package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleAppeal;
import com.javasm.domin.vo.AftersaleAppealVo;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.AfterinitContext.afdic;
@Component
@RequiredArgsConstructor
public class AftersaleAppealTransfer extends BaseTransfer<AftersaleAppeal, AftersaleAppealVo> {
    public List<AftersaleAppealVo> jotoVo(List<AftersaleAppeal> aftersaleAppeals){
        List<AftersaleAppealVo> aftersaleAppealVos = super.toVO(aftersaleAppeals);
        for (int i = 0; i < aftersaleAppealVos.size(); i++) {
            if(aftersaleAppeals.get(i).getBatchState()!=null&&aftersaleAppeals.get(i).getBatchState()!=0){
                aftersaleAppealVos.get(i).setBatchStatename(afdic.get(2).get(aftersaleAppeals.get(i).getBatchState()));
            }
            if(aftersaleAppeals.get(i).getRecordState()!=null&&aftersaleAppeals.get(i).getRecordState()!=0){
                aftersaleAppealVos.get(i).setRecordState(afdic.get(7).get(aftersaleAppeals.get(i).getRecordState()));
            }
            if(aftersaleAppeals.get(i).getAppealType()!=null&&aftersaleAppeals.get(i).getAppealType()!=0){
                aftersaleAppealVos.get(i).setAppealType(afdic.get(8).get(aftersaleAppeals.get(i).getAppealType()));
            }

        }
        return aftersaleAppealVos;
    }
}
